package br.com.linkideias.model.command.endereco;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.hibernate.Session;

import br.com.linkideias.model.bean.Endereco;
import br.com.linkideias.model.command.InterfaceCommand;
import br.com.linkideias.model.dao.HibernateDAO;
import br.com.linkideias.model.dao.InterfaceDAO;
import br.com.linkideias.util.HibernateUtil;

public class ConsultarEndereco implements InterfaceCommand {

	@Override
	public String execute(HttpServletRequest request,
			HttpServletResponse response) {
		InterfaceDAO<Endereco> enderecoDAO = new HibernateDAO<Endereco>(Endereco.class, (Session)request.getAttribute(HibernateUtil.HIBERNATE_SESSION));
		List<Endereco> enderecos= enderecoDAO.getBeans();
		request.setAttribute("enderecos", enderecos);
		return "consulta_endereco.jsp";
	}

}
